//
//  NetworkTools.h
//  OC测试AFN
//
//  Created by teacher on 16/4/17.
//  Copyright © 2016年 teacher. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AFNetworking/AFNetworking.h>

// 定义请求方式的格式
typedef NS_ENUM(NSUInteger, WEXRequestMethod) {
    WEXRequestMethodGet,
    WEXRequestMethodPost
};


@interface WEXNetworkTools : AFHTTPSessionManager

// 设置成一个单例.提供一个全局访问点
+ (instancetype)sharedTools;


// 把执行成功和执行失败都使用同一个block回调
// 如果成功：在回调的时候，传入请求成功的数据，如果失败，就把error回调回去
/// <#Description#>
///
/// @param urlString  请求地址
/// @param parameters 请求参数
/// @param finished   请求完成之后的回调
//- (void)request:(HMRequestMethod)method urlString:(NSString *)urlString parameters:(id)parameters finished:(void(^)(id responseObject, NSError *error))finished;

- (void)request:(WEXRequestMethod)method urlString:(NSString *)urlString parameters:(id)parameters finished:(void (^)(id, NSError *))finished;

//- (NSURLSessionDataTask *)dataTaskWithHTTPMethod:(NSString *)method
//                                       URLString:(NSString *)URLString
//                                      parameters:(id)parameters
//                                  uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgress
//                                downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgress
//                                         success:(void (^)(NSURLSessionDataTask *, id))success
//                                         failure:(void (^)(NSURLSessionDataTask *, NSError *))failure;

@end
